// *************************************************************************************************
//
// MK3D Engine
// --------------------------------------
// Copyright (C) 2007-2011 Zeb (mailto: zebbey@gmail.com)
//
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//
// *************************************************************************************************

#ifndef __H_MK_PARTICLE_RENDERER__
#define __H_MK_PARTICLE_RENDERER__

#include "mk_particle.h"
#include "mk_shader.h"
#include "mk_render_input.h"
#include "mk_particle_common.h"
#include "mk_texture.h"

namespace MK3DE
{
	class CParticleRenderer
	{
	public:
		CParticleRenderer();
		~CParticleRenderer();

		BOOL Create(DWORD preAlocateParticleCount);
		BOOL Destroy();

		BOOL RenderAll(CTexture2D* texture, D3DXMATRIX& mat, PARTICLE_RENDER_BLEND_MODE blendMode);

		BOOL PrepareRender(DWORD particleCount);
		BOOL PushParticle(Particle& p, int textureFrame, DWORD textureCutting, float textureSize);

	private:
		CShader* _shader;
		CRenderInput* _renderInput;
		CHardwareBuffer* _vertexBuffer;
		VERT_3D_COL_TEX1* _vertexBufferPtr;
		DWORD _currentParticleCount;
	};
};

#endif // __H_MK_PARTICLE_RENDERER__